from odoo import api, fields, models
import logging

logger = logging.getLogger(__name__)


class Duty_submit(models.Model):
    _name = 'duty.submit'
    _description = 'user_info'

    name = fields.Char(
        '研发人员详情信息数据申请单详情',
        default='研发人员详情信息数据申请单'
    )

    submit_id = fields.Char(
        string='详情信息数据申请单编号',
        index=True,
        readonly=True,
    )

    @api.model
    def create(self, vals):
        """
        自动生成单号
        :return:
        """
        vals['submit_id'] = self.env['ir.sequence'].next_by_code('duty.submit') or ''
        return super(Duty_submit, self).create(vals)

    duty_useful = fields.Many2one(
        'duty.useful',
        '对应研发追责单疫苗名'
    )
    duty_id = fields.Char(
        string='追责单编号',
        index=True,
        readonly=True,
    )
